<template>
  <div class="player-cover" v-if="song">
    <div
      class="player-cover-left"
      @mouseover="isshowMask = true"
      @mouseout="isshowMask = false"
      @click="getMusic"
    >
      <img :src="song.pic" alt :class="'cover-img-' + isshowMask" />
      <div class="mask" v-show="isshowMask">
        <i class="iconfont iconfangda"></i>
      </div>
    </div>

    <div class="player-cover-right">
      <div class="player-cover-right-songName">
        <span class="player-cover-info">{{ song.name }}</span>
      </div>
      <div class="player-cover-right-songArtist">
        <span class="player-cover-info">{{ song.artist }}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "playerCover",
  props: {
    song: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      isshowMask: false,
    };
  },
  computed: {},
  watch: {
    song() {
      console.log(this.song);
    },
  },
  methods: {
    getMusic() {
      this.$emit("getCurrentMusic", this.song);
    },
  },
};
</script>
<style lang="less" scoped>
.player-cover {
  height: 100%;
  width: 100%;
  display: flex;
  &-left {
    height: 100%;
    width: 18%;
    position: relative;
    overflow: hidden;
  }
  &-right {
    height: 100%;
    width: 82%;
    margin-left: 5px;
    display: flex;
    flex-direction: column;
    align-items: space-around;
    justify-content: space-around;
    &-songName {
      width: auto;
      color: rgb(17, 15, 15);
      font-size: 14px;
    }
    &-songName:hover {
      color: rgb(119, 118, 118);
    }
    &-songArtist {
      width: auto;
      margin-top: 8px;
      font-size: 3px;
    }
  }
  &-info {
    cursor: pointer;
  }
}
img {
  height: 100%;
  width: 100%;
  border-radius: 5px;
  object-fit: cover;
}
.cover-img-true {
  filter: blur(2px);
}
.player-cover-left .mask {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.4);
  color: rgb(171, 171, 171);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.iconfont {
  font-size: 32px !important;
}
</style>